//
//  PywLoginTopView.m
//  PywSdk
//
//  Created by Jade on 4/8/16.
//  Copyright © 2016 zero. All rights reserved.
//

#import "PywLoginTopView.h"
#import "UIImage+Pyw.h"
#import "PywMasonry.h"
#import "PywAppInfo.h"
@interface PywLoginTopView()
@property (nonatomic,strong) UIImageView *topLogoView;
@end

@implementation PywLoginTopView

- (instancetype)init
{
    self = [super init];
    if (self) {
        [self setUp];
    }
    return self;
}


#pragma mark - setUp
- (void)setUp
{
    self.backgroundColor = [PywAppInfo sharedAppInfo].appType == AppTypeFQ?[UIColor clearColor]:[UIColor
                                                                                               colorWithRed:250/255.f
                                                                                               green:250/255.f
                                                                                               blue:250/255.f
                                                                                               alpha:1.f];
    self.contentMode = UIViewContentModeScaleAspectFit;
    self.layer.cornerRadius = [PywAppInfo sharedAppInfo].appType == AppTypeFQ?20:0;
    [self addSubview:self.topLogoView];
    WEAK_SELF;
    [self.topLogoView mas_makeConstraints:^(PywMASConstraintMaker *make) {
        if ([PywAppInfo sharedAppInfo].appType == AppTypeFQ) {
            make.centerY.equalTo(weakSelf.mas_top);
            make.centerX.equalTo(weakSelf.mas_centerX);
            make.width.mas_equalTo(230);
            make.height.mas_equalTo(65);
        }else {
            make.edges.mas_equalTo(UIEdgeInsetsMake(7, 5, 7, 5));
        }
    }];
}

#pragma mark - getter
- (UIImageView *)topLogoView
{
    if (!_topLogoView) {
        UIImage *image = [PywAppInfo sharedAppInfo].appType == AppTypeFQ?[UIImage imageWithName:@"logo00"]:[UIImage imageWithName:@"img_logo"];
        _topLogoView = [[UIImageView alloc] initWithImage:image];
        _topLogoView.contentMode = UIViewContentModeScaleAspectFit;
    }
    return _topLogoView;
}
@end
